import request from '/@/utils/request'
const serverContextPath = '/api'
export function apiMngApi() {
	return {
		serverContextPath: serverContextPath,
		/**
		 * 分页查询
		 * @param {'page': this.pageIndex,
					'limit': this.pageSize,
					'dataForm': this.dataForm} params 
		*/
		queryPage: (params: any) => {
			return request({
				url: serverContextPath + '/apiplantform/mng/list',
				method: 'get',
				params: params
			})
		},

		/**
		 * 根据id获取ApiMng
		 * @param id 主键
		 * @returns {Promise<*>}
		 */
		getApiMngById: (id: string) => {
			return request({
				url: serverContextPath + '/apiplantform/mng/info/' + id,
				method: 'get',
			})
		},

		/**
		 * 新增
		 * @param {} data 
		 * @returns 
		 */
		saveApiMng: (data: any) => {
			return request({
				url: serverContextPath + '/apiplantform/mng/save',
				method: 'post',
				data: data
			})
		},

		/**
		 * 修改ApiMng
		 * @param {*} data 
		 * @returns 
		 */
		updateApiMng: (data: any) => {
			return request({
				url: serverContextPath + '/apiplantform/mng/update',
				method: 'post',
				data: data
			})
		},
		
		/**
		 * 删除ApiMng
		 * @param ids 选中的id数组 var ids = id ? [id] : this.dataListSelections.map(item => {
					return item.id
				})
		* @returns {Promise<*>}
		*/
		deleteApiMng: (ids: any) => {
			return request({
				url: serverContextPath + '/apiplantform/mng/delete',
				method: 'post',
				data: ids
			})
		},

		/**
		 * 根据算法获取秘钥
		 * @param {*} data 
		 * @returns 
		 */
		getSecretByAlgorithm: (data: any) => {
			return request({
				url: serverContextPath + '/apiplantform/mng/getSecretByAlgorithm',
				method: 'post',
				data: data
			})
		}
	}
}